from django.contrib.auth.models import *
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet
from apps.meiduo_admin.serializers.admin import AdminSerializer
from apps.meiduo_admin.serializers.group import GroupSerializer
from apps.meiduo_admin.utils import PageNum
from apps.users.models import *


class AdminModelViewSet(ModelViewSet):
    # is_staff 是普通管理员
    # is_super 是超级管理员
    queryset = User.objects.filter(is_staff=True)

    serializer_class = AdminSerializer

    pagination_class = PageNum


class SimpleGroupListAPIView(ListAPIView):

    queryset = Group.objects.all()

    serializer_class = GroupSerializer
